//
//  HZTestViewController.m
//  MyDoctor
//
//  Created by 王旭 on 16/5/5.
//  Copyright © 2016年 heiyan. All rights reserved.
//接口测试控制器

#import "HZTestViewController.h"
#import "HZNetTools.h"

@interface HZTestViewController ()

@end

@implementation HZTestViewController


#pragma mark -
#pragma mark 接口测试
- (void)viewDidLoad {
    [super viewDidLoad];
    
//    [self test1];
//    [self test2];
//    [self test3];
//    [self test4];
//    [self test5];
//    [self test6];
//    [self test7];
//    [self test8];
//    [self test9];
//    [self test10];
//    [self test11];
//    [self test12];
//    [self test13];
//    [self test14];
}


/** 登录接口 */
//已测试
- (void)test1 {
    NSString *urlString = kLoginUrl;
    NSDictionary *paramDic = @{
        @"login_token":@"985c96ce43bb5ef69de3e1ad8afaa83f"
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 首页轮播器接口 */
//已测试
- (void)test2 {
    NSString *urlString = kBannersUrl;
    NSDictionary *paramDic = @{
        @"login_token":@"985c96ce43bb5ef69de3e1ad8afaa83f",
        @"page_size":@10,
        @"page":@1
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 肿瘤疾病选择疾病细分列表接口 */
//已测试
- (void)test3 {
    NSString *urlString = kSearchCI3Url;
    NSDictionary *paramDic = @{
                               @"page_size":@15,
                               @"page":@1,
                               @"ci1_id":@1,
                               @"keyword":@""
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 根据疾病得到医生数量接口 */
//已测试(死数据)
- (void)test4 {
    NSString *urlString = kMatchedDoctorCountUrl;
    NSDictionary *paramDic = @{
                               @"ci1_id":@1,
                               @"ci2_id":@3,
                               @"ci3_id":@3,
                               @"diagnosis_type":@0,
                               @"is_confirmed":@1,
                               @"user_id":@1000089,
                               @"has_diagnosis":@2
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 选择并发症列表接口 */
//已测试
- (void)test5 {
    NSString *urlString = kComplicationListUrl;
    NSDictionary *paramDic = @{
                             @"page":@1,@"page_size":@15,@"ci2_id":@3
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 获取医生列表接口 */
//已测试
- (void)test6 {
    NSString *urlString = kMatchDoctors;
    NSDictionary *paramDic = @{
                               @"ci1_id":@1,
                               @"ci2_id":@3,
                               @"ci3_id":@3,
                               @"diagnosis_type":@0,
                               @"page_size":@15,
                               @"is_confirmed":@1,
                               @"user_id":@1000089,
                               @"page":@1,
                               @"has_diagnosis":@2
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 获取医生基本信息接口 */
//已测试
- (void)test7 {
    NSString *urlString = kGetDoctorInfoUrl;
    NSDictionary *paramDic = @{
                               @"user_id":@1000089,
                               @"doctor_id":@300000315
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 匹配到医生后，查看医生接诊条件 */
//已测试
- (void)test8 {
    NSString *urlString = kDoctorReceivingSetting;
    NSDictionary *paramDic = @{
                               @"doctor_id":@300000315
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 医生简介接口 */
//已测试
- (void)test9 {
    NSString *urlString = kGetIntroductionUrl;
    NSDictionary *paramDic = @{
                               @"doctor_id":@300000315
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 获取医生就诊时间接口 */
//已测试
- (void)test10 {
    NSString *urlString = kDoctorDuties;
    NSDictionary *paramDic = @{
                               @"doctor_id":@300000315
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 百度天气 */
//已测试
- (void)test11 {
    NSString *city = @"上海";
    NSString *urlString = @"http://api.map.baidu.com/telematics/v3/weather";
    NSDictionary *paramDic = @{
                               @"location":city,
                               @"output":@"json",
                               @"ak":@"17IvzuqmKrK1cGwNL6VQebF9"
                               };
    [[HZNetTools sharedTools]getRequest:urlString parameters:paramDic finishedBlock:^(id responstObject, NSError *error) {
                NSLog(@"responstObject = %@ \n error = %@",responstObject,error);
    }];
    
}

/** 关注医生接口 */
//已测试
- (void)test12 {
    NSString *urlString = kAddDoctorUrl;
    NSDictionary *paramDic = @{
                               @"user_id":@"1000089",
                               @"doctor_id":@300000315
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 取消关注医生接口 */
//已测试
- (void)test13 {
    NSString *urlString = kDeleteDoctorUrl;
    NSDictionary *paramDic = @{
                               @"user_id":@"1000089",
                               @"doctor_id":@300000315
                               };
    [self loadUrl:urlString params:paramDic];
    
}

/** 获取关注医生列表接口 */
- (void)test14 {
    NSString *urlString = kDoctorListUrl;
    NSDictionary *paramDic = @{
                               @"user_id":@"1000089",
                               @"page_size":@15,
                               @"page":@1
                               };
    [self loadUrl:urlString params:paramDic];
    
}



//测试统一调用方法
- (void)loadUrl:(NSString *)urlString params:(NSDictionary *)paramDic {
    //请求地址urlString
    //请求参数params
    //POST请求
    [[HZNetTools sharedTools] postRequest:urlString parameters:paramDic finishedBlock:^(id responstObject, NSError *error) {
        NSLog(@"responstObject = %@ \n error = %@",responstObject,error);
    }];
}

@end
